<?php 

Zend_Loader::loadClass('datetools','library');

$sessao = new Zend_Session_Namespace('segmento'); 
?>  
<html>
<head>
<style>
body {
    font-family: Helvetica; 
    color: #000;
    margin: 0;
    padding: 0;
    width: 650px;
    margin: 0;
    padding: 0;    
}
.pdf_orcamento{
    
} 
.po_topo{
    margin-top: 0px;
    width: 650px;
    height: 78px;
}

.po_topo img{
    width: 615px;
}

.po_corpo{
    min-height: 400px;
    width: 570px;
    margin-top: 0px;
    margin-left: 20px;
    overflow: hidden;
}
.titulo{
    color: #e67817;
    font-weight: bold;
    font-size: 18px;
    text-transform: uppercase;
    padding-top: 10px;
    margin-bottom: 10px;
}
.img_grad{
    margin-top: 20px;
}

.destalhes{
    margin-left:50px;
}
.destalhes td{
    padding: 5px 0;
    
}
.destalhes strong{
    text-transform: uppercase;
    padding-right: 5px;
}

.destalhes td img{ 
    vertical-align: middle;
}       
</style>
</head>
    <body>
        <div class="pdf_orcamento"> 
            <p class="po_topo">
                <img src="<?php echo $this->urlbase;?>/public/media/images/topo_orc.png" />
            </p> 
            
            <table style="width: 590px;margin-left: 30px;margin-top: 10px;">
                <tr>
                    <td>
                        <table style="width: 350px;">
                            <tr>
                                <td><?php echo $this->solicitante->SOL_EMP; ?></td>
                            </tr>
                            <tr>
                                <td>A/C <?php echo $this->solicitante->SOL_NOM; ?></td>
                            </tr>
                            <tr>    
                                <td><?php echo $this->solicitante->SOL_TEL; ?></td>
                            </tr>
                            <tr>   
                                <td><?php echo $this->solicitante->SOL_EML; ?></td>
                            </tr>
                        </table>
                    </td>
                    <td style="width: 200px;text-align: right;">
                        Passo Fundo, <?php echo date('d'); ?> de <?php echo ucfirst(Datetools::texto_Mes(date('m'))); ?> de <?php echo date('Y'); ?>.
                    </td>
                </tr>    
            </table>
            
            <div style="text-align: center;margin-bottom: 20px;">
                Segue abaixo descrição bem como as caracteristicas e valores do produto solicitado
            </div> 
            
            <div class="po_corpo">
                <div style="border: 1px solid #e67817;">
                    <div style="border-bottom: 1px solid #e67817;background-color: #CCC;padding: 5px;font-size: 16px;padding-left: 10px;">
                       <?php echo $this->categoria->CAT_NOM; ?>
                    </div>

                    <table style="width: 600px;">
                        <tr>
                            <td></td>
                            <td>Caracteristica</td>
                            <td>Cores</td>
                            <td>Tamanhos</td>
                        </tr>   
                        <tr>
                            <td style="width: 150px;">
                                <?php
                                $img_tab = glob('public/upload/gradetamanhos/'.$this->pro->GRA_ID.'_tabtam.*'); 
                                if(isset($img_tab[0])){ 
                                ?>
                                <img class="img_grad" src="<?php echo $this->urlbase.'/'.$img_tab[0]; ?>" style="margin-top: -10px;width: 150px;height: 150px;" />
                                <?php } ?>
                            </td>
                            <td style="width: 100px;border-left:1px solid #e67817;padding-left: 10px;">
                                <table>
                                    <tr>
                                        <td>Composição</td>
                                    </tr>
                                    <?php if($this->material->MAT_COM1 > '') echo '<tr><td><strong>'.$this->material->MAT_COM1.'</strong></td></tr>'; ?>
                                    <?php if($this->material->MAT_COM2 > '') echo '<tr><td><strong>'.$this->material->MAT_COM2.'</strong></td></tr>'; ?>
                                    <?php if($this->material->MAT_COM3 > '') echo '<tr><td><strong>'.$this->material->MAT_COM3.'</strong></td></tr>'; ?>
                                    <tr>    
                                        <td>&nbsp;</td>
                                    </tr>
                                    <tr>    
                                        <td>Modelagem</td>
                                    </tr>
                                    <tr>    
                                        <td><strong><?php echo $this->modelagem->MDL_NOM; ?></strong></td>
                                    </tr>
                                </table>
                            </td>
                            <td style="width: 150px;border-left:1px solid #e67817;padding-left: 10px;">
                                <table>
                                    <tr>
                                        <td>Principal</td>
                                    </tr>
                                    <tr>
                                        <td>
                                        <?php
                                            $img = glob('public/upload/cor/'.$this->cor->COR_ID.'.*');
                                            if(!isset($img[0]) && strlen($this->cor->COR_COR) > 0) { ?>
                                                <span style="background-color: #<?php echo $this->cor->COR_COR; ?>" title="<?php echo $this->cor->COR_NOM; ?>"></span>
                                            <?php } elseif(isset($img[0])) { ?>
                                                <img src="<?php echo $this->urlbase.'/'.$img[0]; ?>" title="<?php echo $this->cor->COR_NOM; ?>" />
                                            <?php } ?>
                                            &nbsp;
                                            <strong><?php echo $this->cor->COR_NOM; ?></strong>
                                        </td>
                                    </tr>
                                    <tr>    
                                        <td>&nbsp;</td>
                                    </tr>
                                    <tr>
                                        <td>Cor detalhe</td>
                                    </tr>
                                    <tr>
                                        <td>
                                        <?php 
                                            foreach($this->cordet as $cor){

                                            $cordet = new Sistema_Model_DbTable_Cor();
                                            $cordet = $cordet->fetchRow('COR_ID ='.$cor->COR_ID);

                                            $img = glob('public/upload/cordetalhe/'.$cordet->COR_ID.'.*');
                                            if(!isset($img[0]) && strlen($cordet->COR_COR) > 0) { ?>
                                                <span style="background-color: #<?php echo $cordet->COR_COR; ?>" title="<?php echo $cordet->COR_NOM; ?>"></span>
                                            <?php } elseif(isset($img[0])) { ?>
                                                <img src="<?php echo $this->urlbase.'/'.$img[0]; ?>" title="<?php echo $cordet->COR_NOM; ?>"  />
                                            <?php } ?>
                                            &nbsp;
                                            <strong><?php echo $cordet->COR_NOM; ?></strong>
                                            &nbsp;&nbsp;
                                        <?php } ?>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                            <td style="width: 100px;border-left:1px solid #e67817;padding-left: 10px;">
                                <table>
                                    <tr>
                                        <td>
                                            <table style="width: 100px;">
                                                <?php 
                                                $total = 0;
                                                foreach($this->tamanho as $tam) { 
                                                    $tm = new Sistema_Model_DbTable_Tamanhos();
                                                    $tm = $tm->fetchRow('TAM_ID = '. $tam['TAM_ID']);
                                                    $total += $tam->ORP_QTD;
                                                ?>
                                                <tr>
                                                    <td><?php echo $tm->TAM_NOM; ?></td>
                                                    <td><?php echo $tam->ORP_QTD; ?> unidades</td>
                                                </tr>
                                                <?php } ?> 
                                                <tr>
                                                    <td style="text-align: center;" colspan="2">
                                                        _______________<br>
                                                        <?php echo $total; ?> unidades
                                                    </td>
                                                </tr>
                                            </table>    
                                        </td>
                                    </tr>
                                </table>    
                            </td>
                        </tr>

                        <tr>
                            <td colspan="4">
                                <div style="border-top:1px solid #e67817;width: 100%;margin-left: 20px;margin-top: 10px;">&nbsp;</div>
                            </td>    
                        </tr>

                        <tr>
                            <td colspan="4">
                                <table style="width: 100%;">
                                    <tr>
                                        <td style="text-align: center;">
                                            Valor Unitário <br>
                                            R$ <?php echo $this->data->ORC_VLRUNI; ?>
                                        </td>
                                        <td style="text-align: center;border-left:1px solid #e67817;">
                                            Valor Total <br>
                                            R$ <?php echo $this->data->ORC_VLRTOT; ?>
                                        </td>
                                        <td style="text-align: center;border-left:1px solid #e67817;">
                                            Condições de Pagamento <br>
                                            <?php echo $this->data->ORC_CON; ?>
                                        </td>
                                    </tr>
                                 </table>
                            </td>
                        </tr>      
                        <tr>
                            <td colspan="4">
                                <div style="border-top:1px solid #e67817;width: 100%;margin-left: 10px;margin-top: 10px;">&nbsp;</div>
                            </td>    
                        </tr>

                        <tr>
                            <td colspan="4" style="padding-left: 20px;">
                                Obs: <?php echo $this->data->ORC_OBS; ?><br><br>                            
                            </td>    
                        </tr>

                    </table>    
                </div>
            </div>
            
            <table style="width: 100%;text-align: center;">
                <tr>
                    <td>
                        Atenciosamente,<br>
                        <br>
                        <strong><?php echo Zend_Auth::getInstance()->getStorage()->read()->USU_NOME;?></strong> <br>
                        <?php echo Zend_Auth::getInstance()->getStorage()->read()->USU_EMAIL;?> <br>
                        <?php echo Zend_Auth::getInstance()->getStorage()->read()->USU_TEL;?> <br>
                        <br>
                    </td>
                </tr>
            </table>
        </div>
        <table style="width: 590px;text-align: center;margin-left: 25px;">
            <tr>
                <td style="background-color:#e67817;padding: 5px;color: #FFF;">
                        <?php echo $sessao->CTS_END;?> | <strong><?php echo $sessao->CTS_TEL;?></strong> | <strong><?php echo $_SERVER['HTTP_HOST']; ?></strong>
                </td>
            </tr>
        </table>
        
    </body>
    
<html>